#ifndef AGENT_H
#define AGENT_H

#include "Thread.h"
#include "Sema.h"
#include "Enums.h"
#include <string>
#include <vector>

class Agent : public Thread
{
public:
	Agent(std::string name);
	void stateChanged();
	std::string getName() const;
	bool isBroken;
	bool messagesWillBeDisplayed;
	Sema breakSemaphore;

	virtual void msgToggleBreak();
	void setTracePanel(std::vector<std::string>*);
	
protected:
	virtual void handleBreak();
	virtual void handleFix();

	virtual void run();
	void Do(std::string action);
	void print(std::string text);
	virtual bool pickAndExecuteAnAction() = 0;

private:
	std::vector<std::string>* tracePanel;
	std::string name;
	Sema stateChangedSemaphore;
};

#endif
